
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>深入 · TypeScript Handbook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="Patrick Zhong">
        
        
    
    <link rel="stylesheet" href="../../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="Publishing.html" />
    
    
    <link rel="prev" href="By Example.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../../">
            
                <a href="../../../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../tutorials/">
            
                <a href="../tutorials/">
            
                    
                    快速上手
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../tutorials/TypeScript in 5 minutes.html">
            
                <a href="../tutorials/TypeScript in 5 minutes.html">
            
                    
                    5分钟了解TypeScript
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../tutorials/ASP.NET Core.html">
            
                <a href="../tutorials/ASP.NET Core.html">
            
                    
                    ASP.NET Core
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../tutorials/ASP.NET 4.html">
            
                <a href="../tutorials/ASP.NET 4.html">
            
                    
                    ASP.NET 4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../tutorials/Gulp.html">
            
                <a href="../tutorials/Gulp.html">
            
                    
                    Gulp
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../tutorials/Knockout.html">
            
                <a href="../tutorials/Knockout.html">
            
                    
                    Knockout.js
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../tutorials/React & Webpack.html">
            
                <a href="../tutorials/React & Webpack.html">
            
                    
                    React与webpack
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="../tutorials/React.html">
            
                <a href="../tutorials/React.html">
            
                    
                    React
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="../tutorials/Angular 2.html">
            
                <a href="../tutorials/Angular 2.html">
            
                    
                    Angular 2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9" data-path="../tutorials/Migrating from JavaScript.html">
            
                <a href="../tutorials/Migrating from JavaScript.html">
            
                    
                    从JavaScript迁移到TypeScript
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../">
            
                <a href="../">
            
                    
                    手册
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../Basic Types.html">
            
                <a href="../Basic Types.html">
            
                    
                    基础类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../Variable Declarations.html">
            
                <a href="../Variable Declarations.html">
            
                    
                    变量声明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../Interfaces.html">
            
                <a href="../Interfaces.html">
            
                    
                    接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../Classes.html">
            
                <a href="../Classes.html">
            
                    
                    类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../Functions.html">
            
                <a href="../Functions.html">
            
                    
                    函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../Generics.html">
            
                <a href="../Generics.html">
            
                    
                    泛型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="../Enums.html">
            
                <a href="../Enums.html">
            
                    
                    枚举
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.8" data-path="../Type Inference.html">
            
                <a href="../Type Inference.html">
            
                    
                    类型推论
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.9" data-path="../Type Compatibility.html">
            
                <a href="../Type Compatibility.html">
            
                    
                    类型兼容性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.10" data-path="../Advanced Types.html">
            
                <a href="../Advanced Types.html">
            
                    
                    高级类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.11" data-path="../Utilit Types.md">
            
                <span>
            
                    
                    实用工具类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.12" data-path="../Symbols.html">
            
                <a href="../Symbols.html">
            
                    
                    Symbols
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.13" data-path="../Iterators and Generators.html">
            
                <a href="../Iterators and Generators.html">
            
                    
                    Iterators 和 Generators
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.14" data-path="../Modules.html">
            
                <a href="../Modules.html">
            
                    
                    模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.15" data-path="../Namespaces.html">
            
                <a href="../Namespaces.html">
            
                    
                    命名空间
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.16" data-path="../Namespaces and Modules.html">
            
                <a href="../Namespaces and Modules.html">
            
                    
                    命名空间和模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.17" data-path="../Module Resolution.html">
            
                <a href="../Module Resolution.html">
            
                    
                    模块解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.18" data-path="../Declaration Merging.html">
            
                <a href="../Declaration Merging.html">
            
                    
                    声明合并
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.19" data-path="../Writing Definition Files.html">
            
                <a href="../Writing Definition Files.html">
            
                    
                    书写.d.ts文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.20" data-path="../JSX.html">
            
                <a href="../JSX.html">
            
                    
                    JSX
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.21" data-path="../Decorators.html">
            
                <a href="../Decorators.html">
            
                    
                    Decorators
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.22" data-path="../Mixins.html">
            
                <a href="../Mixins.html">
            
                    
                    混入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.23" data-path="../Triple-Slash Directives.html">
            
                <a href="../Triple-Slash Directives.html">
            
                    
                    三斜线指令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.24" data-path="../Type Checking JavaScript Files.html">
            
                <a href="../Type Checking JavaScript Files.html">
            
                    
                    JavaScript文件里的类型检查
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="Introduction.html">
            
                <a href="Introduction.html">
            
                    
                    如何书写声明文件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="Library Structures.html">
            
                <a href="Library Structures.html">
            
                    
                    结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="Do's and Don'ts.html">
            
                <a href="Do's and Don'ts.html">
            
                    
                    规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="By Example.html">
            
                <a href="By Example.html">
            
                    
                    举例
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.4.4" data-path="Deep Dive.html">
            
                <a href="Deep Dive.html">
            
                    
                    深入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="Publishing.html">
            
                <a href="Publishing.html">
            
                    
                    发布
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="Consumption.html">
            
                <a href="Consumption.html">
            
                    
                    使用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../tsconfig.json.html">
            
                <a href="../tsconfig.json.html">
            
                    
                    工程配置
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../tsconfig.json.html">
            
                <a href="../tsconfig.json.html">
            
                    
                    tsconfig.json
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../Project References.html">
            
                <a href="../Project References.html">
            
                    
                    工程引用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../Typings for NPM Packages.html">
            
                <a href="../Typings for NPM Packages.html">
            
                    
                    NPM包的类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../Compiler Options.html">
            
                <a href="../Compiler Options.html">
            
                    
                    编译选项
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../Configuring Watch.html">
            
                <a href="../Configuring Watch.html">
            
                    
                    配置 Watch
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="../Compiler Options in MSBuild.html">
            
                <a href="../Compiler Options in MSBuild.html">
            
                    
                    在MSBuild里使用编译选项
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.7" data-path="../Integrating with Build Tools.html">
            
                <a href="../Integrating with Build Tools.html">
            
                    
                    与其它构建工具整合
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8" data-path="../Nightly Builds.html">
            
                <a href="../Nightly Builds.html">
            
                    
                    使用TypeScript的每日构建版本
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../../wiki/">
            
                <a href="../../wiki/">
            
                    
                    Wiki
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../../wiki/this-in-TypeScript.html">
            
                <a href="../../wiki/this-in-TypeScript.html">
            
                    
                    TypeScript里的this
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../../wiki/coding_guidelines.html">
            
                <a href="../../wiki/coding_guidelines.html">
            
                    
                    编码规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../../wiki/Common Errors.html">
            
                <a href="../../wiki/Common Errors.html">
            
                    
                    常见编译错误
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../../wiki/TypeScript-Editor-Support.html">
            
                <a href="../../wiki/TypeScript-Editor-Support.html">
            
                    
                    支持TypeScript的编辑器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../../wiki/Using-TypeScript-With-ASP.NET-5.html">
            
                <a href="../../wiki/Using-TypeScript-With-ASP.NET-5.html">
            
                    
                    结合ASP.NET v5使用TypeScript
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="../../wiki/Architectural-Overview.html">
            
                <a href="../../wiki/Architectural-Overview.html">
            
                    
                    架构概述
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="../../wiki/Roadmap.html">
            
                <a href="../../wiki/Roadmap.html">
            
                    
                    发展路线图
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../../release-notes/">
            
                <a href="../../release-notes/">
            
                    
                    新增功能
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../../release-notes/TypeScript 3.1.html">
            
                <a href="../../release-notes/TypeScript 3.1.html">
            
                    
                    TypeScript 3.1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../../release-notes/TypeScript 3.0.html">
            
                <a href="../../release-notes/TypeScript 3.0.html">
            
                    
                    TypeScript 3.0
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../../release-notes/TypeScript 2.9.html">
            
                <a href="../../release-notes/TypeScript 2.9.html">
            
                    
                    TypeScript 2.9
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../../release-notes/TypeScript 2.8.html">
            
                <a href="../../release-notes/TypeScript 2.8.html">
            
                    
                    TypeScript 2.8
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="../../release-notes/TypeScript 2.7.html">
            
                <a href="../../release-notes/TypeScript 2.7.html">
            
                    
                    TypeScript 2.7
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="../../release-notes/TypeScript 2.6.html">
            
                <a href="../../release-notes/TypeScript 2.6.html">
            
                    
                    TypeScript 2.6
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.7" data-path="../../release-notes/TypeScript 2.5.html">
            
                <a href="../../release-notes/TypeScript 2.5.html">
            
                    
                    TypeScript 2.5
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.8" data-path="../../release-notes/TypeScript 2.4.html">
            
                <a href="../../release-notes/TypeScript 2.4.html">
            
                    
                    TypeScript 2.4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.9" data-path="../../release-notes/TypeScript 2.3.html">
            
                <a href="../../release-notes/TypeScript 2.3.html">
            
                    
                    TypeScript 2.3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.10" data-path="../../release-notes/TypeScript 2.2.html">
            
                <a href="../../release-notes/TypeScript 2.2.html">
            
                    
                    TypeScript 2.2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.11" data-path="../../release-notes/TypeScript 2.1.html">
            
                <a href="../../release-notes/TypeScript 2.1.html">
            
                    
                    TypeScript 2.1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.12" data-path="../../release-notes/TypeScript 2.0.html">
            
                <a href="../../release-notes/TypeScript 2.0.html">
            
                    
                    TypeScript 2.0
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.13" data-path="../../release-notes/TypeScript 1.8.html">
            
                <a href="../../release-notes/TypeScript 1.8.html">
            
                    
                    TypeScript 1.8
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.14" data-path="../../release-notes/TypeScript 1.7.html">
            
                <a href="../../release-notes/TypeScript 1.7.html">
            
                    
                    TypeScript 1.7
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.15" data-path="../../release-notes/TypeScript 1.6.html">
            
                <a href="../../release-notes/TypeScript 1.6.html">
            
                    
                    TypeScript 1.6
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.16" data-path="../../release-notes/TypeScript 1.5.html">
            
                <a href="../../release-notes/TypeScript 1.5.html">
            
                    
                    TypeScript 1.5
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.17" data-path="../../release-notes/TypeScript 1.4.html">
            
                <a href="../../release-notes/TypeScript 1.4.html">
            
                    
                    TypeScript 1.4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.18" data-path="../../release-notes/TypeScript 1.3.html">
            
                <a href="../../release-notes/TypeScript 1.3.html">
            
                    
                    TypeScript 1.3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.19" data-path="../../release-notes/TypeScript 1.1.html">
            
                <a href="../../release-notes/TypeScript 1.1.html">
            
                    
                    TypeScript 1.1
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../../breaking-changes/breaking-changes.html">
            
                <a href="../../breaking-changes/breaking-changes.html">
            
                    
                    Breaking Changes
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../../breaking-changes/TypeScript 2.4.html">
            
                <a href="../../breaking-changes/TypeScript 2.4.html">
            
                    
                    TypeScript 2.4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../../breaking-changes/TypeScript 2.3.html">
            
                <a href="../../breaking-changes/TypeScript 2.3.html">
            
                    
                    TypeScript 2.3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../../breaking-changes/TypeScript 2.2.html">
            
                <a href="../../breaking-changes/TypeScript 2.2.html">
            
                    
                    TypeScript 2.2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="../../breaking-changes/TypeScript 2.1.html">
            
                <a href="../../breaking-changes/TypeScript 2.1.html">
            
                    
                    TypeScript 2.1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.5" data-path="../../breaking-changes/TypeScript 2.0.html">
            
                <a href="../../breaking-changes/TypeScript 2.0.html">
            
                    
                    TypeScript 2.0
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.6" data-path="../../breaking-changes/TypeScript 1.8.html">
            
                <a href="../../breaking-changes/TypeScript 1.8.html">
            
                    
                    TypeScript 1.8
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.7" data-path="../../breaking-changes/TypeScript 1.7.html">
            
                <a href="../../breaking-changes/TypeScript 1.7.html">
            
                    
                    TypeScript 1.7
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.8" data-path="../../breaking-changes/TypeScript 1.6.html">
            
                <a href="../../breaking-changes/TypeScript 1.6.html">
            
                    
                    TypeScript 1.6
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.9" data-path="../../breaking-changes/TypeScript 1.5.html">
            
                <a href="../../breaking-changes/TypeScript 1.5.html">
            
                    
                    TypeScript 1.5
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.10" data-path="../../breaking-changes/TypeScript 1.4.html">
            
                <a href="../../breaking-changes/TypeScript 1.4.html">
            
                    
                    TypeScript 1.4
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../.." >深入</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x58F0;&#x660E;&#x6587;&#x4EF6;&#x539F;&#x7406;&#xFF1A;&#x6DF1;&#x5165;&#x63A2;&#x7A76;">&#x58F0;&#x660E;&#x6587;&#x4EF6;&#x539F;&#x7406;&#xFF1A;&#x6DF1;&#x5165;&#x63A2;&#x7A76;</h1>
<p>&#x7EC4;&#x7EC7;&#x6A21;&#x5757;&#x4EE5;&#x63D0;&#x4F9B;&#x4F60;&#x60F3;&#x8981;&#x7684;API&#x5F62;&#x5F0F;&#x4FDD;&#x6301;&#x4E00;&#x81F4;&#x662F;&#x6BD4;&#x8F83;&#x96BE;&#x7684;&#x3002;
&#x6BD4;&#x5982;&#xFF0C;&#x4F60;&#x53EF;&#x80FD;&#x60F3;&#x8981;&#x8FD9;&#x6837;&#x4E00;&#x4E2A;&#x6A21;&#x5757;&#xFF0C;&#x53EF;&#x4EE5;&#x7528;&#x6216;&#x4E0D;&#x7528;<code>new</code>&#x6765;&#x521B;&#x5EFA;&#x4E0D;&#x540C;&#x7684;&#x7C7B;&#x578B;&#xFF0C;
  &#x5728;&#x4E0D;&#x540C;&#x5C42;&#x7EA7;&#x4E0A;&#x66B4;&#x9732;&#x51FA;&#x4E0D;&#x540C;&#x7684;&#x547D;&#x540D;&#x7C7B;&#x578B;&#xFF0C;
  &#x4E14;&#x6A21;&#x5757;&#x5BF9;&#x8C61;&#x4E0A;&#x8FD8;&#x5E26;&#x6709;&#x4E00;&#x4E9B;&#x5C5E;&#x6027;&#x3002;</p>
<p>&#x9605;&#x8BFB;&#x8FD9;&#x7BC7;&#x6307;&#x5B9A;&#x540E;&#xFF0C;&#x4F60;&#x5C31;&#x4F1A;&#x4E86;&#x89E3;&#x5982;&#x679C;&#x4E66;&#x5199;&#x590D;&#x6742;&#x7684;&#x66B4;&#x9732;&#x51FA;&#x53CB;&#x597D;API&#x7684;&#x58F0;&#x660E;&#x6587;&#x4EF6;&#x3002;
&#x8FD9;&#x7BC7;&#x6307;&#x5B9A;&#x9488;&#x5BF9;&#x4E8E;&#x6A21;&#x5757;&#xFF08;UMD&#xFF09;&#x5E93;&#xFF0C;&#x56E0;&#x4E3A;&#x5B83;&#x4EEC;&#x7684;&#x9009;&#x62E9;&#x5177;&#x6709;&#x66F4;&#x9AD8;&#x7684;&#x53EF;&#x53D8;&#x6027;&#x3002;</p>
<h2 id="&#x6838;&#x5FC3;&#x6982;&#x5FF5;">&#x6838;&#x5FC3;&#x6982;&#x5FF5;</h2>
<p>&#x5982;&#x679C;&#x4F60;&#x7406;&#x89E3;&#x4E86;&#x4E00;&#x4E9B;&#x5173;&#x4E8E;TypeScript&#x662F;&#x5982;&#x4F55;&#x5DE5;&#x4F5C;&#x7684;&#x6838;&#x5FC3;&#x6982;&#x5FF5;&#xFF0C;
  &#x90A3;&#x4E48;&#x4F60;&#x5C31;&#x80FD;&#x591F;&#x4E3A;&#x4EFB;&#x4F55;&#x7ED3;&#x6784;&#x4E66;&#x5199;&#x58F0;&#x660E;&#x6587;&#x4EF6;&#x3002;</p>
<h3 id="&#x7C7B;&#x578B;">&#x7C7B;&#x578B;</h3>
<p>&#x5982;&#x679C;&#x4F60;&#x6B63;&#x5728;&#x9605;&#x8BFB;&#x8FD9;&#x7BC7;&#x6307;&#x5357;&#xFF0C;&#x4F60;&#x53EF;&#x80FD;&#x5DF2;&#x7ECF;&#x5927;&#x6982;&#x4E86;&#x89E3;TypeScript&#x91CC;&#x7684;&#x7C7B;&#x578B;&#x6307;&#x662F;&#x4EC0;&#x4E48;&#x3002;
&#x660E;&#x786E;&#x4E00;&#x4E0B;&#xFF0C;<em>&#x7C7B;&#x578B;</em>&#x901A;&#x8FC7;&#x4EE5;&#x4E0B;&#x65B9;&#x5F0F;&#x5F15;&#x5165;&#xFF1A;</p>
<ul>
<li>&#x7C7B;&#x578B;&#x522B;&#x540D;&#x58F0;&#x660E;&#xFF08;<code>type sn = number | string;</code>&#xFF09;</li>
<li>&#x63A5;&#x53E3;&#x58F0;&#x660E;&#xFF08;<code>interface I { x: number[]; }</code>&#xFF09;</li>
<li>&#x7C7B;&#x58F0;&#x660E;&#xFF08;<code>class C { }</code>&#xFF09;</li>
<li>&#x679A;&#x4E3E;&#x58F0;&#x660E;&#xFF08;<code>enum E { A, B, C }</code>&#xFF09;</li>
<li>&#x6307;&#x5411;&#x67D0;&#x4E2A;&#x7C7B;&#x578B;&#x7684;<code>import</code>&#x58F0;&#x660E;</li>
</ul>
<p>&#x4EE5;&#x4E0A;&#x6BCF;&#x79CD;&#x58F0;&#x660E;&#x5F62;&#x5F0F;&#x90FD;&#x4F1A;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x65B0;&#x7684;&#x7C7B;&#x578B;&#x540D;&#x79F0;&#x3002;</p>
<h3 id="&#x503C;">&#x503C;</h3>
<p>&#x4E0E;&#x7C7B;&#x578B;&#x76F8;&#x6BD4;&#xFF0C;&#x4F60;&#x53EF;&#x80FD;&#x5DF2;&#x7ECF;&#x7406;&#x89E3;&#x4E86;&#x4EC0;&#x4E48;&#x662F;&#x503C;&#x3002;
&#x503C;&#x662F;&#x8FD0;&#x884C;&#x65F6;&#x540D;&#x5B57;&#xFF0C;&#x53EF;&#x4EE5;&#x5728;&#x8868;&#x8FBE;&#x5F0F;&#x91CC;&#x5F15;&#x7528;&#x3002;
&#x6BD4;&#x5982;<code>let x = 5;</code>&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x540D;&#x4E3A;<code>x</code>&#x7684;&#x503C;&#x3002;</p>
<p>&#x540C;&#x6837;&#xFF0C;&#x4EE5;&#x4E0B;&#x65B9;&#x5F0F;&#x80FD;&#x591F;&#x521B;&#x5EFA;&#x503C;&#xFF1A;</p>
<ul>
<li><code>let</code>&#xFF0C;<code>const</code>&#xFF0C;&#x548C;<code>var</code>&#x58F0;&#x660E;</li>
<li>&#x5305;&#x542B;&#x503C;&#x7684;<code>namespace</code>&#x6216;<code>module</code>&#x58F0;&#x660E;</li>
<li><code>enum</code>&#x58F0;&#x660E;</li>
<li><code>class</code>&#x58F0;&#x660E;</li>
<li>&#x6307;&#x5411;&#x503C;&#x7684;<code>import</code>&#x58F0;&#x660E;</li>
<li><code>function</code>&#x58F0;&#x660E;</li>
</ul>
<h3 id="&#x547D;&#x540D;&#x7A7A;&#x95F4;">&#x547D;&#x540D;&#x7A7A;&#x95F4;</h3>
<p>&#x7C7B;&#x578B;&#x53EF;&#x4EE5;&#x5B58;&#x5728;&#x4E8E;<em>&#x547D;&#x540D;&#x7A7A;&#x95F4;</em>&#x91CC;&#x3002;
&#x6BD4;&#x5982;&#xFF0C;&#x6709;&#x8FD9;&#x6837;&#x7684;&#x58F0;&#x660E;<code>let x: A.B.C</code>&#xFF0C;
  &#x6211;&#x4EEC;&#x5C31;&#x8BA4;&#x4E3A;<code>C</code>&#x7C7B;&#x578B;&#x6765;&#x81EA;<code>A.B</code>&#x547D;&#x540D;&#x7A7A;&#x95F4;&#x3002;</p>
<p>&#x8FD9;&#x4E2A;&#x533A;&#x522B;&#x867D;&#x7EC6;&#x5FAE;&#x4F46;&#x5F88;&#x91CD;&#x8981; -- &#x8FD9;&#x91CC;&#xFF0C;<code>A.B</code>&#x4E0D;&#x662F;&#x5FC5;&#x9700;&#x7684;&#x7C7B;&#x578B;&#x6216;&#x503C;&#x3002;</p>
<h2 id="&#x7B80;&#x5355;&#x7684;&#x7EC4;&#x5408;&#xFF1A;&#x4E00;&#x4E2A;&#x540D;&#x5B57;&#xFF0C;&#x591A;&#x79CD;&#x610F;&#x4E49;">&#x7B80;&#x5355;&#x7684;&#x7EC4;&#x5408;&#xFF1A;&#x4E00;&#x4E2A;&#x540D;&#x5B57;&#xFF0C;&#x591A;&#x79CD;&#x610F;&#x4E49;</h2>
<p>&#x4E00;&#x4E2A;&#x7ED9;&#x5B9A;&#x7684;&#x540D;&#x5B57;<code>A</code>&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x627E;&#x51FA;&#x4E09;&#x79CD;&#x4E0D;&#x540C;&#x7684;&#x610F;&#x4E49;&#xFF1A;&#x4E00;&#x4E2A;&#x7C7B;&#x578B;&#xFF0C;&#x4E00;&#x4E2A;&#x503C;&#x6216;&#x4E00;&#x4E2A;&#x547D;&#x540D;&#x7A7A;&#x95F4;&#x3002;
&#x8981;&#x5982;&#x4F55;&#x53BB;&#x89E3;&#x6790;&#x8FD9;&#x4E2A;&#x540D;&#x5B57;&#x8981;&#x770B;&#x5B83;&#x6240;&#x5728;&#x7684;&#x4E0A;&#x4E0B;&#x6587;&#x662F;&#x600E;&#x6837;&#x7684;&#x3002;
&#x6BD4;&#x5982;&#xFF0C;&#x5728;&#x58F0;&#x660E;<code>let m: A.A = A;</code>&#xFF0C;
  <code>A</code>&#x9996;&#x5148;&#x88AB;&#x5F53;&#x505A;&#x547D;&#x540D;&#x7A7A;&#x95F4;&#xFF0C;&#x7136;&#x540E;&#x505A;&#x4E3A;&#x7C7B;&#x578B;&#x540D;&#xFF0C;&#x6700;&#x540E;&#x662F;&#x503C;&#x3002;
&#x8FD9;&#x4E9B;&#x610F;&#x4E49;&#x6700;&#x7EC8;&#x53EF;&#x80FD;&#x4F1A;&#x6307;&#x5411;&#x5B8C;&#x5168;&#x4E0D;&#x540C;&#x7684;&#x58F0;&#x660E;&#xFF01;</p>
<p>&#x8FD9;&#x770B;&#x4E0A;&#x53BB;&#x53E6;&#x4EBA;&#x8FF7;&#x60D1;&#xFF0C;&#x4F46;&#x662F;&#x53EA;&#x8981;&#x6211;&#x4EEC;&#x4E0D;&#x8FC7;&#x5EA6;&#x7684;&#x91CD;&#x8F7D;&#x8FD9;&#x8FD8;&#x662F;&#x5F88;&#x65B9;&#x4FBF;&#x7684;&#x3002;
&#x4E0B;&#x9762;&#x8BA9;&#x6211;&#x4EEC;&#x6765;&#x770B;&#x770B;&#x4E00;&#x4E9B;&#x6709;&#x7528;&#x7684;&#x7EC4;&#x5408;&#x884C;&#x4E3A;&#x3002;</p>
<h3 id="&#x5185;&#x7F6E;&#x7EC4;&#x5408;">&#x5185;&#x7F6E;&#x7EC4;&#x5408;</h3>
<p>&#x773C;&#x5C16;&#x7684;&#x8BFB;&#x8005;&#x53EF;&#x80FD;&#x4F1A;&#x6CE8;&#x610F;&#x5230;&#xFF0C;&#x6BD4;&#x5982;&#xFF0C;<code>class</code>&#x540C;&#x65F6;&#x51FA;&#x73B0;&#x5728;<em>&#x7C7B;&#x578B;</em>&#x548C;<em>&#x503C;</em>&#x5217;&#x8868;&#x91CC;&#x3002;
<code>class C { }</code>&#x58F0;&#x660E;&#x521B;&#x5EFA;&#x4E86;&#x4E24;&#x4E2A;&#x4E1C;&#x897F;&#xFF1A;
  <em>&#x7C7B;&#x578B;</em><code>C</code>&#x6307;&#x5411;&#x7C7B;&#x7684;&#x5B9E;&#x4F8B;&#x7ED3;&#x6784;&#xFF0C;
  <em>&#x503C;</em><code>C</code>&#x6307;&#x5411;&#x7C7B;&#x6784;&#x9020;&#x51FD;&#x6570;&#x3002;
&#x679A;&#x4E3E;&#x58F0;&#x660E;&#x62E5;&#x6709;&#x76F8;&#x4F3C;&#x7684;&#x884C;&#x4E3A;&#x3002;</p>
<h3 id="&#x7528;&#x6237;&#x7EC4;&#x5408;">&#x7528;&#x6237;&#x7EC4;&#x5408;</h3>
<p>&#x5047;&#x8BBE;&#x6211;&#x4EEC;&#x5199;&#x4E86;&#x6A21;&#x5757;&#x6587;&#x4EF6;<code>foo.d.ts</code>:</p>
<pre><code class="lang-ts"><span class="hljs-keyword">export</span> <span class="hljs-keyword">var</span> SomeVar: { a: SomeType };
<span class="hljs-keyword">export</span> <span class="hljs-keyword">interface</span> SomeType {
  count: <span class="hljs-built_in">number</span>;
}
</code></pre>
<p>&#x8FD9;&#x6837;&#x4F7F;&#x7528;&#x5B83;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">import</span> * as foo from <span class="hljs-string">&apos;./foo&apos;</span>;
<span class="hljs-keyword">let</span> x: foo.SomeType = foo.SomeVar.a;
<span class="hljs-built_in">console</span>.log(x.count);
</code></pre>
<p>&#x8FD9;&#x53EF;&#x4EE5;&#x5F88;&#x597D;&#x5730;&#x5DE5;&#x4F5C;&#xFF0C;&#x4F46;&#x662F;&#x6211;&#x4EEC;&#x77E5;&#x9053;<code>SomeType</code>&#x548C;<code>SomeVar</code>&#x5F88;&#x76F8;&#x5173;
  &#x56E0;&#x6B64;&#x6211;&#x4EEC;&#x60F3;&#x8BA9;&#x4ED6;&#x4EEC;&#x6709;&#x76F8;&#x540C;&#x7684;&#x540D;&#x5B57;&#x3002;
&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x7EC4;&#x5408;&#x901A;&#x8FC7;&#x76F8;&#x540C;&#x7684;&#x540D;&#x5B57;<code>Bar</code>&#x8868;&#x793A;&#x8FD9;&#x4E24;&#x79CD;&#x4E0D;&#x540C;&#x7684;&#x5BF9;&#x8C61;&#xFF08;&#x503C;&#x548C;&#x5BF9;&#x8C61;&#xFF09;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">export</span> <span class="hljs-keyword">var</span> Bar: { a: Bar };
<span class="hljs-keyword">export</span> <span class="hljs-keyword">interface</span> Bar {
  count: <span class="hljs-built_in">number</span>;
}
</code></pre>
<p>&#x8FD9;&#x63D0;&#x4F9B;&#x4E86;&#x89E3;&#x6784;&#x4F7F;&#x7528;&#x7684;&#x673A;&#x4F1A;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">import</span> { Bar } from <span class="hljs-string">&apos;./foo&apos;</span>;
<span class="hljs-keyword">let</span> x: Bar = Bar.a;
<span class="hljs-built_in">console</span>.log(x.count);
</code></pre>
<p>&#x518D;&#x6B21;&#x5730;&#xFF0C;&#x8FD9;&#x91CC;&#x6211;&#x4EEC;&#x4F7F;&#x7528;<code>Bar</code>&#x505A;&#x4E3A;&#x7C7B;&#x578B;&#x548C;&#x503C;&#x3002;
&#x6CE8;&#x610F;&#x6211;&#x4EEC;&#x6CA1;&#x6709;&#x58F0;&#x660E;<code>Bar</code>&#x503C;&#x4E3A;<code>Bar</code>&#x7C7B;&#x578B; -- &#x5B83;&#x4EEC;&#x662F;&#x72EC;&#x7ACB;&#x7684;&#x3002;</p>
<h2 id="&#x9AD8;&#x7EA7;&#x7EC4;&#x5408;">&#x9AD8;&#x7EA7;&#x7EC4;&#x5408;</h2>
<p>&#x6709;&#x4E00;&#x4E9B;&#x58F0;&#x660E;&#x80FD;&#x591F;&#x901A;&#x8FC7;&#x591A;&#x4E2A;&#x58F0;&#x660E;&#x7EC4;&#x5408;&#x3002;
&#x6BD4;&#x5982;&#xFF0C;<code>class C { }</code>&#x548C;<code>interface C { }</code>&#x53EF;&#x4EE5;&#x540C;&#x65F6;&#x5B58;&#x5728;&#x5E76;&#x4E14;&#x90FD;&#x53EF;&#x4EE5;&#x505A;&#x4E3A;<code>C</code>&#x7C7B;&#x578B;&#x7684;&#x5C5E;&#x6027;&#x3002;</p>
<p>&#x53EA;&#x8981;&#x4E0D;&#x4EA7;&#x751F;&#x51B2;&#x7A81;&#x5C31;&#x662F;&#x5408;&#x6CD5;&#x7684;&#x3002;
&#x4E00;&#x4E2A;&#x666E;&#x901A;&#x7684;&#x89C4;&#x5219;&#x662F;&#x503C;&#x603B;&#x662F;&#x4F1A;&#x548C;&#x540C;&#x540D;&#x7684;&#x5176;&#x5B83;&#x503C;&#x4EA7;&#x751F;&#x51B2;&#x7A81;&#x9664;&#x975E;&#x5B83;&#x4EEC;&#x5728;&#x4E0D;&#x540C;&#x547D;&#x540D;&#x7A7A;&#x95F4;&#x91CC;&#xFF0C;
  &#x7C7B;&#x578B;&#x51B2;&#x7A81;&#x5219;&#x53D1;&#x751F;&#x5728;&#x4F7F;&#x7528;&#x7C7B;&#x578B;&#x522B;&#x540D;&#x58F0;&#x660E;&#x7684;&#x60C5;&#x51B5;&#x4E0B;&#xFF08;<code>type s = string</code>&#xFF09;&#xFF0C;
  &#x547D;&#x540D;&#x7A7A;&#x95F4;&#x6C38;&#x8FDC;&#x4E0D;&#x4F1A;&#x53D1;&#x751F;&#x51B2;&#x7A81;&#x3002;</p>
<p>&#x8BA9;&#x6211;&#x4EEC;&#x770B;&#x770B;&#x5982;&#x4F55;&#x4F7F;&#x7528;&#x3002;</p>
<h3 id="&#x5229;&#x7528;interface&#x6DFB;&#x52A0;">&#x5229;&#x7528;<code>interface</code>&#x6DFB;&#x52A0;</h3>
<p>&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x4E00;&#x4E2A;<code>interface</code>&#x5F80;&#x522B;&#x4E00;&#x4E2A;<code>interface</code>&#x58F0;&#x660E;&#x91CC;&#x6DFB;&#x52A0;&#x989D;&#x5916;&#x6210;&#x5458;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">interface</span> Foo {
  x: <span class="hljs-built_in">number</span>;
}
<span class="hljs-comment">// ... elsewhere ...</span>
<span class="hljs-keyword">interface</span> Foo {
  y: <span class="hljs-built_in">number</span>;
}
<span class="hljs-keyword">let</span> a: Foo = ...;
<span class="hljs-built_in">console</span>.log(a.x + a.y); <span class="hljs-comment">// OK</span>
</code></pre>
<p>&#x8FD9;&#x540C;&#x6837;&#x4F5C;&#x7528;&#x4E8E;&#x7C7B;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">class</span> Foo {
  x: <span class="hljs-built_in">number</span>;
}
<span class="hljs-comment">// ... elsewhere ...</span>
<span class="hljs-keyword">interface</span> Foo {
  y: <span class="hljs-built_in">number</span>;
}
<span class="hljs-keyword">let</span> a: Foo = ...;
<span class="hljs-built_in">console</span>.log(a.x + a.y); <span class="hljs-comment">// OK</span>
</code></pre>
<p>&#x6CE8;&#x610F;&#x6211;&#x4EEC;&#x4E0D;&#x80FD;&#x4F7F;&#x7528;&#x63A5;&#x53E3;&#x5F80;&#x7C7B;&#x578B;&#x522B;&#x540D;&#x91CC;&#x6DFB;&#x52A0;&#x6210;&#x5458;&#xFF08;<code>type s = string;</code>&#xFF09;</p>
<h3 id="&#x4F7F;&#x7528;namespace&#x6DFB;&#x52A0;">&#x4F7F;&#x7528;<code>namespace</code>&#x6DFB;&#x52A0;</h3>
<p><code>namespace</code>&#x58F0;&#x660E;&#x53EF;&#x4EE5;&#x7528;&#x6765;&#x6DFB;&#x52A0;&#x65B0;&#x7C7B;&#x578B;&#xFF0C;&#x503C;&#x548C;&#x547D;&#x540D;&#x7A7A;&#x95F4;&#xFF0C;&#x53EA;&#x8981;&#x4E0D;&#x51FA;&#x73B0;&#x51B2;&#x7A81;&#x3002;</p>
<p>&#x6BD4;&#x5982;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x80FD;&#x6DFB;&#x52A0;&#x9759;&#x6001;&#x6210;&#x5458;&#x5230;&#x4E00;&#x4E2A;&#x7C7B;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">class</span> C {
}
<span class="hljs-comment">// ... elsewhere ...</span>
<span class="hljs-keyword">namespace</span> C {
  <span class="hljs-keyword">export</span> <span class="hljs-keyword">let</span> x: <span class="hljs-built_in">number</span>;
}
<span class="hljs-keyword">let</span> y = C.x; <span class="hljs-comment">// OK</span>
</code></pre>
<p>&#x6CE8;&#x610F;&#x5728;&#x8FD9;&#x4E2A;&#x4F8B;&#x5B50;&#x91CC;&#xFF0C;&#x6211;&#x4EEC;&#x6DFB;&#x52A0;&#x4E00;&#x4E2A;&#x503C;&#x5230;<code>C</code>&#x7684;<em>&#x9759;&#x6001;</em>&#x90E8;&#x5206;&#xFF08;&#x5B83;&#x7684;&#x6784;&#x9020;&#x51FD;&#x6570;&#xFF09;&#x3002;
&#x8FD9;&#x91CC;&#x56E0;&#x4E3A;&#x6211;&#x4EEC;&#x6DFB;&#x52A0;&#x4E86;&#x4E00;&#x4E2A;<em>&#x503C;</em>&#xFF0C;&#x4E14;&#x5176;&#x5B83;&#x503C;&#x7684;&#x5BB9;&#x5668;&#x662F;&#x53E6;&#x4E00;&#x4E2A;&#x503C;
  &#xFF08;&#x7C7B;&#x578B;&#x5305;&#x542B;&#x4E8E;&#x547D;&#x540D;&#x7A7A;&#x95F4;&#xFF0C;&#x547D;&#x540D;&#x7A7A;&#x95F4;&#x5305;&#x542B;&#x4E8E;&#x53E6;&#x5916;&#x7684;&#x547D;&#x540D;&#x7A7A;&#x95F4;&#xFF09;&#x3002;</p>
<p>&#x6211;&#x4EEC;&#x8FD8;&#x53EF;&#x4EE5;&#x7ED9;&#x7C7B;&#x6DFB;&#x52A0;&#x4E00;&#x4E2A;&#x547D;&#x540D;&#x7A7A;&#x95F4;&#x7C7B;&#x578B;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">class</span> C {
}
<span class="hljs-comment">// ... elsewhere ...</span>
<span class="hljs-keyword">namespace</span> C {
  <span class="hljs-keyword">export</span> <span class="hljs-keyword">interface</span> D { }
}
<span class="hljs-keyword">let</span> y: C.D; <span class="hljs-comment">// OK</span>
</code></pre>
<p>&#x5728;&#x8FD9;&#x4E2A;&#x4F8B;&#x5B50;&#x91CC;&#xFF0C;&#x76F4;&#x5230;&#x6211;&#x4EEC;&#x5199;&#x4E86;<code>namespace</code>&#x58F0;&#x660E;&#x624D;&#x6709;&#x4E86;&#x547D;&#x540D;&#x7A7A;&#x95F4;<code>C</code>&#x3002;
&#x505A;&#x4E3A;&#x547D;&#x540D;&#x7A7A;&#x95F4;&#x7684;<code>C</code>&#x4E0D;&#x4F1A;&#x4E0E;&#x7C7B;&#x521B;&#x5EFA;&#x7684;&#x503C;<code>C</code>&#x6216;&#x7C7B;&#x578B;<code>C</code>&#x76F8;&#x4E92;&#x51B2;&#x7A81;&#x3002;</p>
<p>&#x6700;&#x540E;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x8FDB;&#x884C;&#x4E0D;&#x540C;&#x7684;&#x5408;&#x5E76;&#x901A;&#x8FC7;<code>namespace</code>&#x58F0;&#x660E;&#x3002;
Finally, we could perform many different merges using <code>namespace</code> declarations.
This isn&apos;t a particularly realistic example, but shows all sorts of interesting behavior:</p>
<pre><code class="lang-ts"><span class="hljs-keyword">namespace</span> X {
  <span class="hljs-keyword">export</span> <span class="hljs-keyword">interface</span> Y { }
  <span class="hljs-keyword">export</span> <span class="hljs-keyword">class</span> Z { }
}

<span class="hljs-comment">// ... elsewhere ...</span>
<span class="hljs-keyword">namespace</span> X {
  <span class="hljs-keyword">export</span> <span class="hljs-keyword">var</span> Y: <span class="hljs-built_in">number</span>;
  <span class="hljs-keyword">export</span> <span class="hljs-keyword">namespace</span> Z {
    <span class="hljs-keyword">export</span> <span class="hljs-keyword">class</span> C { }
  }
}
<span class="hljs-keyword">type</span> X = <span class="hljs-built_in">string</span>;
</code></pre>
<p>&#x5728;&#x8FD9;&#x4E2A;&#x4F8B;&#x5B50;&#x91CC;&#xFF0C;&#x7B2C;&#x4E00;&#x4E2A;&#x4EE3;&#x7801;&#x5757;&#x521B;&#x5EFA;&#x4E86;&#x4EE5;&#x4E0B;&#x540D;&#x5B57;&#x4E0E;&#x542B;&#x4E49;&#xFF1A;</p>
<ul>
<li>&#x4E00;&#x4E2A;&#x503C;<code>X</code>&#xFF08;&#x56E0;&#x4E3A;<code>namespace</code>&#x58F0;&#x660E;&#x5305;&#x542B;&#x4E00;&#x4E2A;&#x503C;&#xFF0C;<code>Z</code>&#xFF09;</li>
<li>&#x4E00;&#x4E2A;&#x547D;&#x540D;&#x7A7A;&#x95F4;<code>X</code>&#xFF08;&#x56E0;&#x4E3A;<code>namespace</code>&#x58F0;&#x660E;&#x5305;&#x542B;&#x4E00;&#x4E2A;&#x503C;&#xFF0C;<code>Z</code>&#xFF09;</li>
<li>&#x5728;&#x547D;&#x540D;&#x7A7A;&#x95F4;<code>X</code>&#x91CC;&#x7684;&#x7C7B;&#x578B;<code>Y</code></li>
<li>&#x5728;&#x547D;&#x540D;&#x7A7A;&#x95F4;<code>X</code>&#x91CC;&#x7684;&#x7C7B;&#x578B;<code>Z</code>&#xFF08;&#x7C7B;&#x7684;&#x5B9E;&#x4F8B;&#x7ED3;&#x6784;&#xFF09;</li>
<li>&#x503C;<code>X</code>&#x7684;&#x4E00;&#x4E2A;&#x5C5E;&#x6027;&#x503C;<code>Z</code>&#xFF08;&#x7C7B;&#x7684;&#x6784;&#x9020;&#x51FD;&#x6570;&#xFF09;</li>
</ul>
<p>&#x7B2C;&#x4E8C;&#x4E2A;&#x4EE3;&#x7801;&#x5757;&#x521B;&#x5EFA;&#x4E86;&#x4EE5;&#x4E0B;&#x540D;&#x5B57;&#x4E0E;&#x542B;&#x4E49;&#xFF1A;</p>
<ul>
<li>&#x503C;<code>Y</code>&#xFF08;<code>number</code>&#x7C7B;&#x578B;&#xFF09;&#xFF0C;&#x5B83;&#x662F;&#x503C;<code>X</code>&#x7684;&#x4E00;&#x4E2A;&#x5C5E;&#x6027;</li>
<li>&#x4E00;&#x4E2A;&#x547D;&#x540D;&#x7A7A;&#x95F4;<code>Z</code></li>
<li>&#x503C;<code>Z</code>&#xFF0C;&#x5B83;&#x662F;&#x503C;<code>X</code>&#x7684;&#x4E00;&#x4E2A;&#x5C5E;&#x6027;</li>
<li>&#x5728;<code>X.Z</code>&#x547D;&#x540D;&#x7A7A;&#x95F4;&#x4E0B;&#x7684;&#x7C7B;&#x578B;<code>C</code></li>
<li>&#x503C;<code>X.Z</code>&#x7684;&#x4E00;&#x4E2A;&#x5C5E;&#x6027;&#x503C;<code>C</code></li>
<li>&#x7C7B;&#x578B;<code>X</code></li>
</ul>
<h2 id="&#x4F7F;&#x7528;export-&#x6216;import">&#x4F7F;&#x7528;<code>export =</code>&#x6216;<code>import</code></h2>
<p>&#x4E00;&#x4E2A;&#x91CD;&#x8981;&#x7684;&#x539F;&#x5219;&#x662F;<code>export</code>&#x548C;<code>import</code>&#x58F0;&#x660E;&#x4F1A;&#x5BFC;&#x51FA;&#x6216;&#x5BFC;&#x5165;&#x76EE;&#x6807;&#x7684;<em>&#x6240;&#x6709;&#x542B;&#x4E49;</em>&#x3002;</p>
<!-- TODO: Write more on that. -->
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="By Example.html" class="navigation navigation-prev " aria-label="Previous page: 举例">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="Publishing.html" class="navigation navigation-next " aria-label="Next page: 发布">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"深入","level":"1.4.4","depth":2,"next":{"title":"发布","level":"1.4.5","depth":2,"path":"doc/handbook/declaration files/Publishing.md","ref":"./doc/handbook/declaration files/Publishing.md","articles":[]},"previous":{"title":"举例","level":"1.4.3","depth":2,"path":"doc/handbook/declaration files/By Example.md","ref":"./doc/handbook/declaration files/By Example.md","articles":[]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"Patrick Zhong","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"preface.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"TypeScript Handbook","language":"zh-hans","gitbook":">3.0.0","description":"Translation of official TypeScript Handbook"},"file":{"path":"doc/handbook/declaration files/Deep Dive.md","mtime":"2018-10-13T09:48:54.000Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-10-13T09:57:42.904Z"},"basePath":"../../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../../gitbook/gitbook.js"></script>
    <script src="../../../gitbook/theme.js"></script>
    
        
        <script src="../../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

